﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Reflection;
using System.IO;

namespace Plugin
{
    public class Config
    {
        /// <summary>
        /// 服务名称
        /// </summary>
        private string _ServiceName = "特种厂019-5出库单监视器";

        public string ServiceName
        {
            get
            {
                return _ServiceName;
            }
        }

        /// <summary>
        /// 插件版本
        /// </summary>
        private string _DLLVersion = "1.0";

        public string DLLVersion
        {
            get
            {
                return _DLLVersion;
            }
        }

        /// <summary>
        /// 运行间隔，默认60秒执行一次
        /// </summary>
        private int _RunInterval = 300;

        public int RunInterval
        {
            get
            {
                return _RunInterval;
            }
        }

        /// <summary>
        /// 显示设置窗体
        /// </summary>
        public void ShowConfig()
        {
            frmConfig newFrmConfig = new frmConfig();
            newFrmConfig.Show();
        }
    }

    public class Service
    {
        private SqlTools sqt;

        public Service()
        {
            StringBuilder tmpsb = new StringBuilder();
            GeneralTools.GetPrivateProfileString("Config", "Factory", string.Empty, tmpsb, 256, System.Windows.Forms.Application.StartupPath + "\\Plugin\\Monitor_Gxck_Config.ini");
            string strFactoryName = tmpsb.ToString();
            string strDBName = string.Empty;
            switch (strFactoryName )
            {
                case "片容厂":
                    strDBName = "TPAMain";
                    break;
                case "特种厂":
                case "微波事业部":
                    strDBName = "TPAMainTZ";
                    break;
                default:
                    strDBName = "TPAMain";
                    break;
            }
            //初始化SQL查询对象
            sqt = new SqlTools(GeneralTools.GetConnectionString(strDBName ));
        }

        public void Start()
        {

        }
    }
}
